import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @Author cc
 * @PackageName meiye
 * @Package PACKAGE_NAME
 * @Date 2022/7/23 15:14
 * @Version 1.0
 */
public class time {
    public static void main(String[] args) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format1 = sdf.format(date);
        System.out.println(format1);
    }

   @Test
    public  void test01() throws ParseException {
       String s = "2022-07-23 20:56:54";
       SimpleDateFormat simpleDateFormat =   new SimpleDateFormat(  "yyyy-MM-dd HH:mm:ss" );
       Date date = simpleDateFormat.parse(s);
       long ts = date.getTime();
       System.out.println(ts);
   }
}
